from django.db import models

# Create your models here.

class Student(models.Model):
    '''
    学生表
    '''
    name=models.CharField(max_length=32,verbose_name='学生姓名')
    age=models.IntegerField(verbose_name='学生年龄')
    gender_choice=((1,'男'),(2,'女'))
    gender=models.SmallIntegerField(choices=gender_choice,default=1)
    department=models.ForeignKey(to='Department',on_delete=models.CASCADE,verbose_name='班级',default=1)
    teacher=models.ManyToManyField(to='Teacher',blank=True,verbose_name='教师')
    def __str__(self):
        return self.name

    class Meta:
        db_table='web_student'
        verbose_name='学生表'
        verbose_name_plural=verbose_name

class Department(models.Model):
    '''
    学生班级
    '''
    name=models.CharField(max_length=32,verbose_name='班级')

    def __str__(self):
        return self.name

class Teacher(models.Model):
    '''
    老师
    '''
    name=models.CharField(max_length=32,verbose_name='教师姓名')

    def __str__(self):
        return self.name